package com.gy.training.ui;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Spinner;
import android.widget.TextView;

import com.gy.training.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnItemSelected;

public class CitySpinnerActivity extends AppCompatActivity {
    @BindView(R.id.city_select)
    TextView textView;
    @BindView(R.id.spinner)
    Spinner spinner;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_city_spinner);
        ButterKnife.bind(CitySpinnerActivity.this);
    }
    @OnItemSelected(value = R.id.spinner,callback = OnItemSelected.Callback.ITEM_SELECTED)
    public void onItemSeleced(int position){
        String[] arrays = getResources().getStringArray(R.array.city_labels);
        textView.setText("你去的城市是："+arrays[position]);


    }

}
